package org.example.ag_notes.dto.response;
import org.springframework.http.HttpStatus;

public class ErrorResponse {
    private final int status;
    private final String error;
    private final String message;
    private final String path;
    private final long timestamp;

    // 全参数构造方法
    public ErrorResponse(int status, String error, String message, String path, long timestamp) {
        this.status = status;
        this.error = error;
        this.message = message;
        this.path = path;
        this.timestamp = timestamp;
    }

    // 快速创建方法（推荐）
    public static ErrorResponse of(HttpStatus status, String message, String path) {
        return new ErrorResponse(
                status.value(),
                status.getReasonPhrase(),
                message,
                path,
                System.currentTimeMillis()
        );
    }

    // Getter 方法
    public int getStatus() { return status; }
    public String getError() { return error; }
    public String getMessage() { return message; }
    public String getPath() { return path; }
    public long getTimestamp() { return timestamp; }
}